import { ToolCallback } from "@modelcontextprotocol/sdk/server/mcp.js"
import { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js"
import { ZodAny, ZodRawShape } from "zod"

export function defineTool<
  OutputArgs extends ZodRawShape | ZodAny,
  InputArgs extends undefined | ZodRawShape | ZodAny = undefined,
>(options: {
  name: string
  title?: string
  description?: string
  inputSchema?: InputArgs
  outputSchema?: OutputArgs
  annotations?: ToolAnnotations
  _meta?: Record<string, unknown>
  callback: ToolCallback<InputArgs>
}) {
  const { name, callback, ...rest } = options
  return [name, rest, callback] as const
}
